﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Xml.Linq;
using eschoolBO;

namespace ESCHOOL.parents
{
    public partial class WebForm6 : System.Web.UI.Page
    {
        parent_feedback pf = new parent_feedback();
        teacher teach = new teacher();
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                DataTable dt1=teach.GetRecords(-99,"","","","","","",-99,-99,-99,"","","","","",false," and ");
                DropDownList1.DataSource = dt1;
                DropDownList1.DataTextField = "teacher_name";
                DropDownList1.DataValueField="teacher_id";
                DropDownList1.DataBind();
                DataTable dt = pf.GetRecords(-99, Convert.ToInt64(Session["userid"]), -99, "", false, " and ");
                GridView1.DataSource = dt;
                GridView1.DataBind();
            }
        }

        protected void btnsend_Click(object sender, EventArgs e)
        {
            pf.pfeedback_id = -99;
            pf.parent_id = Convert.ToInt64(Session["userid"].ToString());
            pf.teacher_id = Convert.ToInt64(DropDownList1.SelectedValue.ToString());
            pf.feedback = tbmsg.Text;
            pf.isdeleted = false;
            pf.SaveRecords();
            Response.Redirect("~/parents/PFeedback.aspx");
        }

        protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
        {
            GridView1.PageIndex = e.NewPageIndex;
            DataTable dt = pf.GetRecords(-99, Convert.ToInt64(Session["userid"]), -99, "", false, " and ");
            GridView1.DataSource = dt;
            GridView1.DataBind();
        }
    }
}
